package com.starbooks.tmail.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.*;


@Configuration
public class MyWebAppConfigurer extends WebMvcConfigurerAdapter{

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    registry.addInterceptor(new MyHandlerInterceptor()).addPathPatterns("/**");
    super.addInterceptors(registry);
  }

  @Override
  public void addViewControllers(ViewControllerRegistry registry) {
    registry.addViewController("login1").setViewName("login1");
  }

  @Bean
  public LocaleResolver localeResolver(){
    return new MyLocaleResolver();
  }

//  @Override
//  public void addResourceHandlers(ResourceHandlerRegistry registry) {
//    //文件磁盘图片url 映射
//    //配置server虚拟路径，handler为前台访问的目录，locations为files相对应的本地路径
//    registry.addResourceHandler("/upload").addResourceLocations("file:"+ "D://upload//");
//  }

}
